package com.itheima.text1;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Demo1 {
    public static void main(String[] args) {
            //创建一个默认的线程池    池子中默认为空,默认最大容量为int最大值
        ExecutorService executorService = Executors.newCachedThreadPool();
            //Executors  创建线程池对象



        //executorService  控制线程池对象
        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName()+"线程执行");
        });

        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName()+"线程执行");
        });


        executorService.shutdown();
    }
}
